export TOP := $(shell pwd)
export _DEBUG_ := y

TARGET := zblog
OBJS := main.o
SUBDIRS := utils cgi

CFLAGS-${_DEBUG_} += -g -ggdb
CFLAGS-y += -I${TOP}
CFLAGS-y += -D_GNU_SOURCE -D__USE_XOPEN
CFLAGS-y += -Wall -Wno-missing-braces
#CFLAGS-y += -Werror
#CFLAGS-y += -DMYSQL=1
CFLAGS-${_DEBUG_} += -DDEBUG_ON=1
#CFLAGS-y += -DDEBUG_VERBOSE_ON=1

LIBS-y := -Llib
LIBS-y += -lholyhttp
LIBS-y += -lsqlite3
# LIBS-y += -lmariadb
# LIBS-y += -lmysql
LIBS-y += -lssl -lcrypto -pthread -lm

########## DO NOT MODIFY THE BELOW ##########
export CFLAGS := ${CFLAGS-y}
export LIBS := ${LIBS-y}

myall: subs ${TARGET}

include ${TOP}/common.mk

${TARGET}: ${OBJS} ${SUBOBJS}
	${CC} -o $@ $^ ${CFLAGS} ${LIBS}
	${STRIP} $@

